package cn.kgc.ffzw.day23.QuickHit;

import java.util.Scanner;

public class Player {
    //玩家当前级别号（levelNo）
    //玩家当前级别积分（currScore）
    //当前级别开始时间（startTime）
    //当前级别已用时间（elapsedTime
    int levelNo;
    int currScore;
    long startTime;
    int elapsedTime;

    public int getLevelNo() {
        return levelNo;
    }

    public void setLevelNo(int levelNo) {
        this.levelNo = levelNo;
    }

    public int getCurrScore() {
        return currScore;
    }

    public void setCurrScore(int currScore) {
        this.currScore = currScore;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public int getElapsedTime() {
        return elapsedTime;
    }

    public void setElapsedTime(int elapsedTime) {
        this.elapsedTime = elapsedTime;
    }




    public Player() {

    }

    public Player(int levelNo, int currScore, long startTime, int elapsedTime) {
        this.levelNo = levelNo;
        this.currScore = currScore;
        this.startTime = startTime;
        this.elapsedTime = elapsedTime;
    }

    public void play(){
        Scanner scanner = new Scanner(System.in);
        Game game = new Game();
        for (int i = 0; i < 6; i++) {
            int strTime = LevelParam.list.get(this.getLevelNo()).getStrTimes();
            long currTime = System.currentTimeMillis();
            this.setStartTime(currTime);
            game.setPlayer(this);
            System.out.println("游戏开始");
            String input;
            String ouput;
            while (strTime>0){
                ouput = game.printStr();
                System.out.println(ouput);
                input = scanner.next();
                game.printResult(ouput,input);
                strTime--;
            }
            this.setCurrScore(0);
            this.setElapsedTime(0);
            this.setLevelNo(this.getLevelNo()+1);
        }
    }
}
